const { Server } = require('socket.io')
let io = null
const socketApi = require('./socketApi.js')
const initSocket = (server) => {
    console.log('初始化socket')
    io = new Server(server, { cors: true });
    broadcastQue = []
    // 监听连接事件
    io.on('connection', (socket) => {
        console.log('用户连接')
        socketApi.addUser(socket)
    })
}

module.exports = initSocket